<%@ Page Language="C#" EnableViewState="false" ValidateRequest="false" AutoEventWireup="true" 
	Inherits="Syrinx.Gui.AspNet.Ajax.NitobiBasePage" MasterPageFile="~/App_ThemeMasters/NoStyle/AdminOneColumnLayout.Master" EnableEventValidation="false" %>
<%@ Register Assembly="Swaf.Gui.AspNet2" Namespace="Swaf.Gui.AspNet2" TagPrefix="swf" %>
<%@ Register Assembly="ScsAspNet" Namespace="Syrinx.Gui.AspNet.Ajax" TagPrefix="saj" %><%@ Register Assembly="NitobiControls" Namespace="Nitobi" TagPrefix="ntb" %>
<%@ Register Assembly="ScsAspNet" Namespace="Articles.Gui.AspNet" TagPrefix="art" %>

<!--#include file="~/SiteControls/RegisterStandardControls.txt"-->
<!--#include file="../SiteControls/StandardAdminHeaderPageContent.inc"-->
<!--#include file="../SiteControls/StandardFooterPageContent.inc"-->

<script runat="server">
	public string TitleFormat = "$company.name$ - Site Page Management";
</script>

<asp:Content ID="c1" ContentPlaceHolderID="title" runat="server">
	<%SecurityPrivilege = "AppFunctions.ManageCompanyConfiguration"; %>
	<script type="text/javascript">
		function toggleTabs(cId, c1, dId) {
			for (i = 1; ; i++) {
				var a = document.getElementById(cId + i);
				var b = document.getElementById(dId + i);
				if (a == null || a == '')
					break;

				if (i == c1) {
					a.className = 'currenttab';
					b.style.display = 'block';
				}
				else {
					a.className = '';
					b.style.display = 'none';
				}
			}
		}
	</script>

    <h1 ID="_ImgCacheLibLbl" runat="server">Page Management</h1>
    <div class="HelpBtnArea" style="float:right">
		<asp:HyperLink runat="server" ID="_pageHelp" NavigateUrl="../std/Help.aspx?helpid=SitePageManagementHelp" Target="help">Help</asp:HyperLink>
	</div>
</asp:Content>

<asp:Content ID="c3" ContentPlaceHolderID="mainContent" runat="server">
    <swf:BizProc ID="pagesBP" runat="server" FactoryName="pageEditor">
		<ParentBizProc id="loginBP" />
    </swf:BizProc>
    <swf:BizProc ID="salsBP" runat="server" FactoryName="salEditor">
		<State previewWidgetId="salPreview" />
		<ParentBizProc id="pagesBP" fieldName="pageName" dataId="pid" />
    </swf:BizProc>
	<swf:BizProc ID="menuTypesBP" runat="server" FactoryName="menuTypesEditor">
		<ParentBizProc id="loginBP" />
	</swf:BizProc>
	<swf:BizProc ID="menusBP" runat="server" FactoryName="menuEditor">
		<ParentBizProc id="menuTypesBP" fieldName="menus" dataId="pid" fullDependency="true" />
	</swf:BizProc>
	<swf:BizProc ID="menuItemsBP" runat="server" FactoryName="menuItemEditor">
		<ParentBizProc id="menusBP" fieldName="menuItems" dataId="pid" fullDependency="true" />
	</swf:BizProc>

	<table cellspacing="0" cellpadding="0" border="0"><tr>
	<td style="vertical-align:bottom;"><div class="tabs" >
		<ul>
			<li id="t1" class="currenttab"><div class="firstTab"><swf:DivLayers runat="server" ID="tl1" SkinID="Tab"><asp:HyperLink onclick="toggleTabs('t','1','ta');" runat="server" ID="_cmpMngrTab1" Text="Page Details" NavigateUrl="javascript:;" /></swf:DivLayers></div></li>
			<li id="t2"><swf:DivLayers runat="server" ID="tl2" SkinID="Tab"><asp:HyperLink runat="server" onclick="toggleTabs('t','2','ta');" ID="_pubInfLbl" Text="Page Elements" NavigateUrl="javascript:;" /></swf:DivLayers></li>
			<li id="t3"><div class="lastTab"><swf:DivLayers runat="server" ID="tl3" SkinID="Tab"><asp:HyperLink runat="server" onclick="toggleTabs('t','3','ta');" ID="_cmpMngrTab3" Text="Site Menus" NavigateUrl="javascript:;" /></swf:DivLayers></div></li>
		</ul>
	</div></td>
	<td><div class="sideTabsCombo">
		<table><tr>
			<td style="vertical-align:middle"><asp:Label runat="server" ID="_pgsLbl" Text="Site Page:" /></td>
			<td><saj:Combo ID="pageCmb" runat="server" ParentBizProcIds="pagesBP" DataTextField="pageName" Mode="Classic">
					<TextBox Width="200" /><List Width="200" Height="225" />
					<Columns>
						<ntb:BoundColumn DataField="pageName" HeaderText="Name" width="200" />
					</Columns>
			</saj:Combo></td>
		</tr></table>
	</div></td>
    </tr></table>
	<swf:DivLayers ID="mdl1" runat="server" SkinID="MainTabArea">
		<div id="ta1">
        <span class="button6"><saj:ActionButton runat="server" ID="updateBtn1" Actions="pagesBP.UpdateBizObj" Text="Update" /></span>
	    <span class="button1"><saj:ActionButton runat="server" ID="addBtn" Actions="pagesBP.AddBizObj" Text="Add" /></span>
	    <span class="button2"><saj:ActionButton runat="server" ID="cancelBtn" Actions="pagesBP.CancelEdits" Text="Cancel" /></span>
	    <span class="button5"><saj:ActionButton runat="server" ID="deleteBtn" Actions="pagesBP.DeleteBizObj" Text="Delete" ClientClick="if(!confirm('Are you sure you want to delete?'))return false;"/></span>
			<saj:NitobiBizObjDisplay runat="server" ID="pageDet" ParentBizProcIds="pagesBP"
				EditableTemplate="PageEditing.Gui.AspNet.PageOptionsRWDisplay">
			</saj:NitobiBizObjDisplay>	
		</div>
		<div id="ta2" style="display:none;">
			<div style="float:left;margin:15px;">
			<table><tr><td>
				<asp:Label runat="server" ID="_salsLbl" Text="Page Element:" />
			</td><td>
				<saj:Combo ID="salsCmb" runat="server" ParentBizProcIds="salsBP" DataTextField="id" Mode="Classic">
					<TextBox Width="100" /><List Width="345" Height="150" />
					<Columns>
						<ntb:BoundColumn DataField="id" HeaderText="Name" width="75" />
						<ntb:BoundColumn DataField="pid" HeaderText="PID" Width="120" />
						<ntb:BoundColumn DataField="ListTemplate" HeaderText="Template" Width="150" />
					</Columns>
				</saj:Combo>
			</td></tr></table>
				<saj:ActionButton runat="server" ID="ActionButton2" Actions="salsBP.UpdateBizObj" Text="Update" />
				<saj:ActionButton runat="server" ID="previewBtn" Actions="salsBP.Preview" Text="Preview"  />
				<div class="clearer"></div>
				<saj:NitobiBizObjDisplay runat="server" ID="ad3" ParentBizProcIds="salsBP"
					TemplateNameBizRule="getSalEditorType">
				</saj:NitobiBizObjDisplay>	
			</div>
			<div style="float:left;min-width:400px;max-width:500px;">
				<art:SalBizObjDisplay runat="server" ID="salPreview" ParentBizProcIds="salsBP" />
			</div>
			<div class="clearer"></div>
		</div>
		<div id="ta3" style="display:none;">
			<table><tr><td>
				<asp:Label runat="server" ID="_mnuTypLbl" Text="Menu Types:" />
			</td><td>
				<saj:Combo ID="Combo1" runat="server" ParentBizProcIds="menuTypesBP" DataTextField="id" Mode="Unbound">
					<TextBox Width="100" /><List Width="100" Height="150" />
					<Columns>
						<ntb:BoundColumn DataField="id" width="100" />
					</Columns>
				</saj:Combo>
			</td><td>
		        <span class="button6"><saj:ActionButton runat="server" ID="ActionButton1" Actions="menuTypesBP.UpdateBizObj" Text="Update" /></span>
			</td>
			</tr></table>
			
						<div style="padding-top:10px;float:left">
						<saj:Grid ID="articleList1Display" runat="server" Width="150px" Height="350px"
							ParentBizProcIds="menusBP" Mode="LiveScrolling" Resizable="Both" AllowAddRow="true" AllowDeleteRow="true" >
							<Toolbars>
								<ntb:GridToolbar Title="Standard">
									<ntb:AddButtonItem Click="this.grid.BizProc.triggerEvent(this.grid.ClientControl.id, 'addBizObj', '');" />
									<ntb:DeleteButtonItem />
								</ntb:GridToolbar>
							</Toolbars>
							<Columns>
								<ntb:KeyColumn DataField="id" />
								<ntb:BoundColumn DataField="name" HeaderText="Name" width="100" />
							</Columns>
						</saj:Grid>					
						</div>
					<div style="padding-left:10px;padding-top:10px;float:left">
						<saj:NitobiBizObjDisplay runat="server" ID="mnDtls" ParentBizProcIds="menusBP"
							EditableTemplate="PageEditing.Gui.AspNet.MenuRWDisplay">
						</saj:NitobiBizObjDisplay>
					
						<saj:Grid ID="Grid1" runat="server" Width="550px" Height="300px" UpdateOnRowChange="false" AjaxEventOnRowSelect="false"
							ParentBizProcIds="menuItemsBP" Mode="LiveScrolling" Resizable="Both" AllowAddRow="true" AllowDeleteRow="true" >
							<Toolbars>
								<ntb:GridToolbar Title="Standard">
									<ntb:AddButtonItem />
									<ntb:DeleteButtonItem />
									<ntb:SeparatorItem />
									<ntb:ButtonItem Tooltip="Move Up" />
									<ntb:ButtonItem Tooltip="Move Down" />
								</ntb:GridToolbar>
							</Toolbars>
							<Columns>
								<ntb:KeyColumn DataField="id" />
								<ntb:BoundColumn DataField="displayName" HeaderText="Name" width="125" ReadOnly="false" />
								<ntb:BoundColumn DataField="url" HeaderText="Location" width="200" ReadOnly="false" />
								<ntb:BoundColumn DataField="securityAppFunction" HeaderText="Required Access" Width="200" />
								<ntb:CheckboxColumn DataField="reuseWindow" HeaderText="Same Window" Width="100" ReadOnly="false" />
							</Columns>
						</saj:Grid>					
						</div>
						<div class="clearer"></div>
		</div>		
	</swf:DivLayers>
	
    <script type="text/javascript">
    	function previewSal() {salsBPBizProc.triggerEvent("ctl00_mainContent_previewBtn", "Preview");}
    </script>
</asp:Content>

